package com.newtouch.cq.security.exception;

import com.newtouch.cq.lang.exception.IMccExceptionInfo;
import lombok.Getter;
import org.springframework.security.authentication.InternalAuthenticationServiceException;

/**
 * @author Alex
 * @Description 权限异常类
 * @time 2021/8/25 15:14
 */
@Getter
public class AuthException extends InternalAuthenticationServiceException implements IMccExceptionInfo<String> {

    private String code;

    private String message;

    public AuthException(String msg, Throwable cause) {
        super(msg, cause);
    }

    public AuthException(String msg) {
        super(msg);
    }

    public AuthException (IMccExceptionInfo<String> exceptInfo) {
        super(exceptInfo.getMessage());
        this.message = exceptInfo.getMessage();
        this.code = exceptInfo.getCode();
    }

    public AuthException setMessage(String message) {
        this.message = message;
        return this;
    }
}
